<script type="text/javascript">
function appendVal(id, val, type){
	var myId = document.getElementById(id);
	if(type=="new"){
		var myVal = document.createTextNode(val);
	}else if(type=="add"){
		var myVal = document.createTextNode(","+val);
	}
	myId.appendChild(myVal); 
}
</script>
[#-- 创建商品所有属性属性的自定义宏，参数：par_datalist 商品所有属性，var_isprice 是否为价格属性。--]
[#macro ecs_goodsallattr par_datalist var_isprice]
[#if par_datalist ??]
	[#--var_isprice为ture生成价格属性--]
	[#if var_isprice]
	<li id="priceArea" class="padd loop" >
	[#--参数bgaTattr用于判断价格属性类型是否相同--]
	[#assign bgaTattri = "0"]
	[#list par_datalist as data]
		[#if data.bgaTattri!=bgaTattri]
			[#switch data.btaAtype]
				[#case 0]
					[#break]
				[#case 1]
					[#if bgaTattri == "0"]
						<strong>${data.btaName}</strong>
					[#else]
						<br/><strong>${data.btaName}</strong>
					[/#if]
						[#if data.bgaPrice??]
							<br/>
							<label for="${data.bgaId}">
								<input id="${data.bgaId}" checked="true" type="radio" onclick="init()" name="rg-${data.bgaTattri}" value="${data.bgaPrice}"/>
									${data.bgaValue}
								[#if data.bgaPrice != 0 ]
									${r"["}加￥${data.bgaPrice}元${r"]"}
								[/#if]	
							</label>
						[/#if]	
					[#break]
				[#case 2]
					[#if bgaTattri == "0"]
						<strong>${data.btaName}</strong>
					[#else]
						<br/><strong>${data.btaName}</strong>
					[/#if]
						[#if data.bgaPrice??]
							<br/>
							<label for="${data.bgaId}">
								<input id="${data.bgaId}" type="checkbox" onclick="init()" name="cb-${data.bgaTattri}" value="${data.bgaPrice}"/>
								${data.bgaValue}${r"["}加￥${data.bgaPrice}元${r"]"}
							</label>
						[/#if]	
					[#break]	
				[#default]
					[#break]		
			[/#switch]
		[#else]
			[#switch data.btaAtype]
				[#case 0]
					[#break]
				[#case 1]
					[#if data.bgaPrice??]
						<br/>
						<label for="${data.bgaId}">
							<input id="${data.bgaId}" type="radio" onclick="init()" name="rg-${data.bgaTattri}" value="${data.bgaPrice}"/>
							${data.bgaValue}${r"["}加￥${data.bgaPrice}元${r"]"}
						</label>
					[/#if]	
					[#break]
				[#case 2]
					[#if data.bgaPrice??]
						<br/>
						<label for="${data.bgaId}">
							<input id="${data.bgaId}" type="checkbox" onclick="init()" name="cb-${data.bgaTattri}" value="${data.bgaPrice}"/>
							${data.bgaValue}${r"["}加￥${data.bgaPrice}元${r"]"}
						</label>
					[/#if]	
					[#break]	
				[#default]
					[#break]		
			[/#switch]
		[/#if]
		[#if data.btaAtype != 0]
			[#assign bgaTattri=data.bgaTattri]
		[/#if]
	[/#list]
	</li>
	[#else]
	[#--var_isprice为false生成所有属性--]
	<blockquote>
	<table width="100%" border="0" cellpadding="3" cellspacing="1"
		bgcolor="#dddddd">
		<tr>
			<th colspan="2" bgcolor="#FFFFFF">
				商品属性
			</th>
		</tr>
		[#--参数bgaTattr用于判断价格属性类型是否相同--]
		[#assign bgaTattri = "0"]
		[#list par_datalist as data]
			[#if data.bgaTattri!=bgaTattri]
			<tr>
				<td bgcolor="#FFFFFF" align="left" width="30%" class="f1">
					${r"["}${data.btaName}${r"]"}
				</td>
				<td bgcolor="#FFFFFF" align="left" width="70%" id="val-${data.bgaTattri}"></td>
				<script type="text/javascript">
						appendVal("val-${data.bgaTattri}","${data.bgaValue}","new");
				</script>
			</tr>
			[#else]
				<script type="text/javascript">
					appendVal("val-${data.bgaTattri}","${data.bgaValue}","add");
				</script>
			[/#if]
			[#assign bgaTattri=data.bgaTattri]
		[/#list]
	</table>	
	</blockquote>
	[/#if]
[/#if]
[/#macro]
